<script setup>
import { ref } from 'vue'
import { onLaunch, onShow, onLoad } from '@dcloudio/uni-app'
//引入API
import { getHotAPI } from '@/api/home.js'
//引入子组件
import ItemVue from './Item.vue'
//请求数据初始化页面
const hotList = ref([])
const gethot = async () => {
  const res = await getHotAPI()
  hotList.value = res.result
}
onLoad(async () => {
  await gethot()
})
</script>

<template>
  <view class="hot-panel">
    <ItemVue v-for="(item, index) in hotList" :item="item" :key="index" />
  </view>
</template>

<style lang="scss">
.hot-panel {
  display: flex;
  flex-wrap: wrap;
  padding: 10rpx;

  > * {
    width: 50%;
    box-sizing: border-box;
    padding: 10rpx;
  }
}
</style>
